<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>角色列表</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" type="text/css" href="$request.getContextPath()/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="$request.getContextPath()/resources/bsgrid/css/bsgrid.all.min.css"/>
<!-- <link rel="stylesheet" href="$request.getContextPath()/resources/bsgrid/css/bsgrid-blue.css"/> -->
<link rel="stylesheet" href="$request.getContextPath()/resources/bsgrid/css/bootstrap-responsive.min.css"/>
<link rel="stylesheet" href="$request.getContextPath()/resources/cws/system/role/list.css"/>

</head>
<body>
<div class="container-fluid">
    <!-- 搜索框 -->
	<div class="searchform">
	 	<form class="form-horizontal" role="form" action="javascript:void(0)">
		  <div class="form-group">
		    <label for="roleType" class="col-sm-1 control-label">角色类型</label>
		    <div class="col-sm-2">
		      <select class="form-control" id="roleTypeSelect" placeholder="请输入角色类型">
				  <option value="">所有角色</option>
				  <option value="admin">管理角色</option>
				  <option value="user">普通角色</option>
			  </select>
		    </div>
		    <label for="roleName" class="col-sm-1 control-label">角色名称</label>
		    <div class="col-sm-2">
		      <input type="text" class="form-control" name="roleName" placeholder="请输入角色名称">
		    </div>
		    <div class="col-sm-2">
		      <button type="button" onclick="queryRole()" class="btn btn-default">查询</button>
		    </div>
		  </div>
		</form>
	</div>
	<!-- 工具栏 -->
	<div class="toolbar">
		    #if($shiro.hasPermission('system:role:add'))
				<button type="button" class="btn btn-default btn-sm" onclick="addRole()"><span class="glyphicon glyphicon-plus"></span>添加</button>
		    #end
			#if($shiro.hasPermission('system:role:export'))
		        #if($model.has('sys_role'))
					<a type="button" class="btn btn-default btn-sm" href="$request.getContextPath()/common/export/excel/sys_user/xlsx"><span class="glyphicon glyphicon-export"></span>导出</a>
				#end
			#end
			<!--#if($shiro.hasPermission('system:role:statistics'))
				<button type="button" class="btn btn-default btn-sm" onclick="roleStatistics()"><span class="glyphicon glyphicon-star"></span>统计</button>
			#end-->
	</div>
	<!-- bsgrid角色表格 -->
    <table id="bsgridTable">
        <tr>
            <th w_render="checkbox" w_index="ID" width="3%" w_hidden="true"><input type="checkbox"/></th>
            <th w_index="roleId" width="5%" w_hidden="true">角色ID</th>
            <th w_index=roleCode width="5%">角色内码</th>
            <th w_index="roleName" w_align="left" width="15%">角色名称</th>
            <th w_index="roleType" w_align="left" width="10%">角色类型</th>
            <th w_index="roleStatus" w_hidden="true" width="15%" >角色状态</th>
            <th w_index="remark" width="20%">角色描述</th>
            <th w_render="operate" width="10%">操作</th>
        </tr>
    </table>
</div>
</body>
<script type="text/javascript" src="$request.getContextPath()/resources/jquery/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="$request.getContextPath()/resources/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="$request.getContextPath()/resources/layer/layer.js"></script>
<script type="text/javascript" src="$request.getContextPath()/resources/bsgrid/js/lang/grid.zh-CN.js"></script>
<script type="text/javascript" src="$request.getContextPath()/resources/bsgrid/js/bsgrid.all.min.js"></script>
<script type="text/javascript">
	function operate(record, rowIndex, colIndex, options){
		//用户角色权限按钮
		var rolePermissionButtons=[];
		var roleViewPermission="$shiro.hasPermission('system:role:view')";
		if(roleViewPermission&&roleViewPermission=="true"){
			rolePermissionButtons.push('<button type="button" class="btn btn-default btn-sm" onclick="roleDetail('+record.roleId+')"><span class="glyphicon glyphicon-eye-open"></span>查看</button>');
		}
		var roleEditPermission="$shiro.hasPermission('system:role:edit')";
		if(roleEditPermission&&roleEditPermission=="true"){
			rolePermissionButtons.push('<button type="button" class="btn btn-default btn-sm" onclick="editRole('+record.roleId+')"><span class="glyphicon glyphicon-edit"></span>编辑</button>');
		}
		var roleDeletePermission="$shiro.hasPermission('system:role:delete')";
		if(roleDeletePermission&&roleDeletePermission=="true"){
			rolePermissionButtons.push('<button type="button" class="btn btn-default btn-sm" onclick="roleDelete('+record.roleId+','+record.roleName+')"><span class="glyphicon glyphicon-trash"></span>删除</button>');
		}
		var roleAllowMenuPermission="$shiro.hasPermission('system:role:allowMenu')";
		if(roleAllowMenuPermission&&roleAllowMenuPermission=="true"){
			rolePermissionButtons.push('<button type="button" class="btn btn-default btn-sm" onclick="allowMenu('+record.roleId+')"><span class="glyphicon glyphicon-tree-deciduous"></span>分配菜单</button>');
		}
		var roleAllowPermissionPermission="$shiro.hasPermission('system:role:allowPermission')";
		if(roleAllowPermissionPermission&&roleAllowPermissionPermission=="true"){
			rolePermissionButtons.push('<button type="button" class="btn btn-default btn-sm" onclick="allowPermission('+record.roleId+')"><span class="glyphicon glyphicon-tree-deciduous"></span>分配权限</button>');
		}
		return rolePermissionButtons.join('');
	}
</script>
<script type="text/javascript" src="$request.getContextPath()/resources/cws/system/role/list.js"></script>
</html>
#parse("/portal/account/footer2.html")